// index.js

Page({
  data: {
    arr: [],
    arr2: [],
    arr3:[],
    searchtext:"",
  },
  goList(evt){
    wx.navigateTo({
      url: '/pages/listxq/listxq?id='+evt.currentTarget.dataset.id,
    })
  },
  onPullDownRefresh() {
    
    //关闭下拉刷新
    wx.stopPullDownRefresh({
      success: (res) => {},
    })
  
  },
  onReachBottom() {
    console.log("触发了上拉刷新")

  },

  goCate(evt){
    // 跳转到分类页面，这里假设分类页面是cate
    wx.navigateTo({
      url: '/pages/cate/cate?id='+evt.currentTarget.dataset.id,
    })
  },
  search(e){
    console.log(e.detail.value);
    wx.navigateTo({
      url: '/pages/searchlist/searchlist?str='+e.detail.value,
      
    })
  },
  onLoad(Option) {
    console.log(12323)
    wx.request({
      url: 'https://www.xuzhixiang.top:30001/api/banner/list',
      method: 'get',
      success: res => {
        this.setData({
          arr: res.data.data
        })
      },
      fail: err => {
        console.log(err);
      }
    });
  
    wx.request({
      url: 'https://www.xuzhixiang.top:30001/api/menu/list',
      method: "get",
      success: res => {
        console.log(res.data.data)
        this.setData({
          arr2: res.data.data
        })
      },
      fail: err => {
        console.log(err);
      }
    })
    wx.request({
      url: 'https://www.xuzhixiang.top:30001/api/pro/list',
      method: "get",
      success: res => {
        console.log(res.data.data)
        this.setData({
          arr3: res.data.data
        })
      },
      fail: err => {
        console.log(err);
      }
    })
  },

})
